from django.contrib import admin
from course.models import *


# Register your models here.

class StudentCourseAdmin(admin.ModelAdmin):
    list_display = ['student', 'course', 'score', 'semester']
    list_display_links = ['student', 'course', 'score', 'semester']
    search_fields = ('student__username', 'course__name')


class CourseAdmin(admin.ModelAdmin):
    list_display = ['name']
    list_display_links = ['name']


class FacultyMajorAdmin(admin.ModelAdmin):
    list_display = ['name', 'get_course_to_str', 'faculty', ]
    list_display_links = ['name', 'get_course_to_str', 'faculty', ]
    list_filter = ('name', 'faculty')
    filter_horizontal = ('courses',)


class SchoolFacultyAdmin(admin.ModelAdmin):
    list_display = ['name', 'get_faculty_major']
    list_display_links = ['name', 'get_faculty_major']


admin.site.register(SchoolFaculty, SchoolFacultyAdmin)
admin.site.register(Course, CourseAdmin)
admin.site.register(FacultyMajor, FacultyMajorAdmin)
admin.site.register(StudentCourse, StudentCourseAdmin)
admin.site.register(Semester)
